package io.itit.ecp.admin.provide.action.resp.miniprogram;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;


/**
 * 储能统计
 */
@Data
@Accessors(chain = true)
@ApiModel("储能统计")
public class ChargingStationStatisticsResp implements Serializable {

    @ApiModelProperty("充电桩利用率")
    private BigDecimal storage;

    @ApiModelProperty("充电次数")
    private Integer chargingCycles;

    @ApiModelProperty("放电次数")
    private Integer dischargeFrequency;

    @ApiModelProperty("充放电状态")
    private String state;

    @ApiModelProperty("当前功率")
    private BigDecimal currentPower;

    @ApiModelProperty("今日收益")
    private BigDecimal todayInCome;

    @ApiModelProperty("累计收益")
    private BigDecimal totalInCome;

    @ApiModelProperty("统计信息")
    private List<StaticsInfo> staticsInfos;

    public String getStateName() {
        if (StringUtils.isNotEmpty(this.state)) {
            return StringUtils.equals(this.state, "1") ? "充当中" : "放电中";
        }
        return "";
    }

    @Data
    @Accessors(chain = true)
    @ApiModel("统计信息")
    public static class StaticsInfo implements Serializable {

        @ApiModelProperty("名称")
        private String name;

        @ApiModelProperty("数据")
        private List<DataItem> dataItems;
    }


    @Data
    @Accessors(chain = true)
    @ApiModel("统计信息")
    public static class DataItem implements Serializable {

        @ApiModelProperty("时间")
        private String time;

        @ApiModelProperty("值")
        private BigDecimal value;
    }


}
